package com.hboxs.asl.qcloudLVB.util;

import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

/**
 * Created by xxx on 2016/10/12.
 */
public class QcloudDateUtils {
    /**
     * 过期时间
     * 当前时间加n分钟,转换为
     *
     * @param n
     */
    public static Long getTxTime(int n) {
        Long txTime;
        Calendar cal = getCalendar(new Date());
        cal.add(Calendar.MINUTE, n);
        Date date = cal.getTime();
        //转换成Unix时间戳
        txTime = date.getTime() / 1000L;
        return txTime;
    }

    public static Long getTxTime24(long time) {
        long txTime = new Date().getTime() + time;
        return txTime;
    }


    public static Calendar getCalendar(Date date) {
        Calendar cal = Calendar.getInstance(Locale.CHINESE);
        cal.setTime(date);
        return cal;
    }

}